package com.grablist.feihu.grablist.ui.actviity.user.biz;

import java.util.List;

import com.grablist.feihu.grablist.base.BaseBiz;
import com.grablist.feihu.grablist.base.BaseResp;
import com.grablist.feihu.grablist.bean.MsgInfo;
import com.grablist.feihu.grablist.comm.BaseSubscribe2;
import com.grablist.feihu.grablist.comm.RetrofitHelp;
import rx.android.schedulers.AndroidSchedulers;
import rx.schedulers.Schedulers;

/**
 * Created by admin on 2017/12/2.
 */

public class MsgBiz extends BaseBiz {

    /**
     * 消息记录
     * @param userCode
     * @param userCode
     * @param callback
     */
    public void messagePage(String userCode, final BaseBiz.Callback<List<MsgInfo>> callback) {
        com.add(RetrofitHelp.getSecretApi().messagePage(userCode)
                .subscribeOn(Schedulers.io())
                .observeOn(AndroidSchedulers.mainThread())
                .subscribe(new BaseSubscribe2<BaseResp<List<MsgInfo>>>() {

                    @Override
                    public void onSuccess(Object obj) {
                        callback.onSuccess((List<MsgInfo>) obj);
                    }

                    @Override
                    public void onFailure(Object obj) {
                        callback.onFailure((List<MsgInfo>) obj);
                    }
                })
        );
    }
}
